package day13;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class Array {
    int id;
    String name;
    int score;
    public Array(int id, String name, int score) {
        this.id = id;
        this.name = name;
        this.score = score;
    }
    public static void main(String[] args) {
        Score sc = new Score();
        sc.list();
    }
}

class Score {
    public void list() {
        List<Array> list = new ArrayList<>();
        Random rd = new Random();
        int n;
        for (int i = 0; i < 40; i++) {
            n = rd.nextInt(50)+51;
            list.add(new Array(180200+i, "张三" + i, n));
        }
        Collections.sort(list, (o1, o2) -> {
            int m = o2.score-o1.score;
            if (m == 0) {
                m = o1.id-o2.id;
            }
            return m;
        });
        for (Array a:list){
            System.out.println("学号："+a.id+",姓名："+a.name+",成绩"+a.score);
        }
    }
}